﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QStandardItemModel>
#include <QCloseEvent>
#include <QtSql/QSqlDatabase>
#include <QtSql/QSqlQuery>
#include <QtSql/QSqlError>
#include <QSqlRecord>
#include <QDebug>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

struct Net_Info
{
	QString ip;
	QString mac;
};

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    QString MainWindow::getipandmac();
    //void processWindowsIPConfig(const std::string& config);
     void MainWindow::showbutton(bool outbutton, bool savebutton);
     bool MainWindow::datasave(QString name, QString group, QString type, QList<Net_Info> NetInfos);

private slots:
    void on_pushButton_clicked();


    void on_pushButton_2_clicked();
    bool on_pushButton_3_clicked();


public slots:

signals:
    void freshData();

private:
    Ui::MainWindow *ui;
    QStringList filterLines(const QStringList& lines);
    void MainWindow::loadSettings();
    void MainWindow::saveSettings();
    QString name;
    QString group;
    QString DeviceName;
    QString youxianip;
    QString youxianmac;
    QString wuxianip;
    QString wuxianmac;
   
   
protected:
    // 重载 closeEvent 方法
    void closeEvent(QCloseEvent* event) override {
        saveSettings();

        qDebug() << "查询失败:";

        event->accept();  // 接受关闭事件
    }
};

#endif // MAINWINDOW_H
